home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / aecontrol / aectrl.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1992-12-26  |  8.2 KB  |  226 lines

  1. /*********************** AEControl *******************************/
  2. /* if you are using 2.0 NewShell set the s bit (protect dmstxt.rexx +s) */
  3. /* or whatever.... */
  4. /* This is the NewShell one. Dmstxt.wsh is the one for Bill Hawes Wshell */
  5. /*
  6.   to change the text forthe dms file use:
  7.   DTC -s s:warpsig -d s:dmstext.dms
  8.  
  9. */
  10.  
  11. /* I was not gonna release this util but what the hell.. This one is for the *
  12.  * Lazy sysop. It automatically adds your own warp test to dms, wrp, lzh and *
  13.  * .doc files... Doc files it adds a control character at the beginning so   *
  14.  * a user must down load the file & not view it. then at the end of the .doc *
  15.  * file, it addes your own text.                                             *
  16.  * THE WAY IT WORKS...                                                       *
  17.  * change conf.1 thru conf.7 to your own conferences and if you have conf.8  *
  18.  * you can add that but you have to change the do r = 1 to 6 to what ever    *
  19.  * is applicable for your bbs.                                               *
  20.  * When a user logs off, this util looks at each conference's upload dir and *
  21.  * if it generates a file in ram: called shit (Ram:Shit) This file consists  *
  22.  * of all files in that conferences upload dir. now it proceeds to run thru  *
  23.  * this list (RAM:SHIT) and if it finds a .dms, .wrp, .lzh or .doc file, it  *
  24.  * processes it, adding your warp text. after it processes the file it moves *
  25.  * it to newdir, in mycase its called request: this is an assigned dir of    *
  26.  * mine that is in every conferences path so a user can still download these *
  27.  * files, but since I haven't looked at them yet, I want them in a single    *
  28.  * dir.. SO you gotta change newdir to the dir you want the files sent to    *
  29.  * after they are processed (warp text added).  So far this does not do zoo  *
  30.  * arc, lha and other files. but 99% of the files you get will be dms, wrp   *
  31.  *.lzh or doc files. also it sets a flag which re-runs my top util if a dms  *
  32.  * file has been processed (natch cause you wanna update the uploader        *
  33.  * especially if he is on the top list... this way you dont have to run the  *
  34.  * top util everytime a user logs off. The current version of Top is v1.9a   *
  35.  * You also must have Arexx and generate a warpsig msg thru DTR & WTR to     *
  36.  * add your warp text. I know this seems a little confusing but once you     *
  37.  * get this completely set up, you wil never have to manually add your own   *
  38.  * WARP TEXT. I did this in arexx since the actual warp text adders are      *
  39.  * already written is assy or C, Arexx only hooks this shit up to do the job.*
  40.  * under my 33 mhz 030 its sufficient, especially since I don't have to add  *
  41.  * my warp text by hand..                                                    *
  42.  * READ Thru thos code so you can lear a little yourself & since I am doing  *
  43.  * Tthese docs while fucked up I probably missed something                   *
  44.  * SpaZM ... 407 631-9123... SCOOPEX                                         */
  45.  
  46. /* I INCLUDED AN ExAMPLE OF MY head.doc and warpsig that is appended to *.doc*
  47.  * files. You create your own & install in the BBS: dir                      */
  48.  
  49. /* in your bbsbatch file add a line execute s:test
  50.  * and in the s:test file have this one line .. RX AECONTROL and this program *
  51.    will be executed. remember to copy AEcontrol to your Rexx: dir & set the   *
  52.  * s bit... protect Rexx:AEControl +S
  53.  * SpaZM ... 407 631-9286... SCOOPEX                                         */
  54.  
  55.  
  56. /*==================CUT HERE =====================================*/
  57. conf.3 = "BBS:Elite/Upload/"
  58.  
  59.  
  60. /* adds my dmstext to dms files */
  61. YES = 1
  62. NO = 0
  63. TRUE = YES
  64. FALSE = NO
  65. dms_total  = 0
  66. warp_total = 0
  67. newdir = "DH1:BBS/Files/Elite/"    /* dir to move added text files to. */
  68. descname = "BBS:Elite/dir4"
  69. donewtop = FALSE       /* if set, re-run top util          */
  70.  
  71. r = 3         /* go thru every conference I only use 6 for uploads */
  72.  call workEM conf.r
  73.  
  74. ADDRESS COMMAND "date >>RAM:lastwork"  /* save date of list time we ran */
  75. exit
  76.  
  77. /* This is the heart of the program to add mytest to the end of files */
  78. workEM:
  79. arg dirname
  80.  
  81.  /* make sure dirname ends in either ':' or '/' */
  82.  if right(dirname,1) ~= ':' then
  83.    if right(dirname,1) ~= '/' then   dirname = dirname || '/'
  84.  
  85.  
  86.  'set dateformat=0'
  87.  out. = 0
  88.  
  89.  /* build a list in ram of all files in conf upload dir */
  90.  ADDRESS COMMAND 'list >ram:shit 'dirname'#? dates nohead'
  91.  
  92.  call get_tempfile(FALSE)   /* read in the file it built  */
  93.  if RESULT == FALSE then return   /* no files to check */
  94.  
  95.  
  96. do z = 1 to out.0
  97.  suffix = UPPER(Right(word(out.z,1),4))
  98.  select
  99.   /* when suffix == ".WRP" then call do_warp(z)*/
  100.    when suffix == ".DMS" then DO
  101.    call do_dms(z)
  102.    ADDRESS COMMAND "DIRSIZE "descname " " newdir || word(out.z,1) 
  103.    END
  104.    when suffix == ".LZH" then DO
  105.    call do_lharc(z)
  106.    ADDRESS COMMAND "DIRSIZE "descname " " newdir || word(out.z,1) 
  107.    END
  108.    when suffix == ".LHA" then DO
  109.    call do_lz(z)
  110.    ADDRESS COMMAND "DIRSIZE "descname " " newdir || word(out.z,1) 
  111.    END
  112.    when suffix == ".DOC" then DO
  113.    call do_doc(z)
  114.    ADDRESS COMMAND "DIRSIZE "descname " " newdir || word(out.z,1) 
  115.    END
  116.    when suffix == ".TXT" then DO
  117.    call do_doc(z)
  118.    ADDRESS COMMAND "DIRSIZE "descname " " newdir || word(out.z,1) 
  119.    END
  120.    otherwise NOP
  121.    end
  122. end
  123.  
  124. return
  125.  
  126. /* NOTE:  create a file in your BBS: dir called head.doc and in this file
  127.    put one control character. This will begin the doc files. ALSO
  128.    make a file called BBS:WarpSIg to be added to the end of the doc file
  129. */
  130. /* THIS DOES .DOC FILES */
  131. do_doc:    /* add a control char to top of doc file, the my add at the end */
  132. arg i
  133.  
  134. ADDRESS COMMAND "join BBS:head.doc " dirname || word(out.i,1) " BBS:warpsig as " newdir || word(out.i,1)
  135. ADDRESS COMMAND "Delete " dirname || word(out.i,1) " quiet"
  136. return
  137.  
  138. do_dms:
  139. arg i
  140.  
  141.   /* remove text file file to ram: */
  142.   ADDRESS COMMAND "DTR_V0.5 "dirname || word(out.i,1)
  143.  
  144.   /* add my text to the file */
  145.   ADDRESS COMMAND 'Join 'dirname || word(out.i,1) 's:dmstext.dms to ram:'word(out.i,1)
  146.  
  147.   /* copy ram: file back to dir */
  148.   ADDRESS COMMAND 'copy ram:'word(out.i,1) ' ' dirname 
  149.  
  150.   ADDRESS COMMAND "Delete " "ram:" || word(out.i,1) " quiet"        /* delete the file in ram after copying */
  151.  
  152.   /* reset date back to real date & time it was uploaded */
  153.   ADDRESS COMMAND 'setdate 'dirname || word(out.i,1) word(out.i,4) left(word(out.i,5),5)
  154.  
  155.   /* Move file to our holding dir, but users can still dnload */
  156.   ADDRESS COMMAND "Copy "dirname || word(out.i,1) " " newdir " dates"   /* move file */
  157.   ADDRESS COMMAND "Delete "dirname || word(out.i,1) " quiet"   /* move file */
  158.  
  159.   donewtop = TRUE          /* it was a decent size file so redo top listings */
  160.  
  161. return
  162.  
  163. do_lharc:
  164. arg i
  165.  
  166.  /* add my text to the lzh files */            /* chage this to your readme file*/
  167.  ADDRESS COMMAND "Lharc a "dirname || word(out.i,1)" s:scoopex.txt.displayme"   /* add my bbs ad */
  168.  
  169.  /* move the file to our hold dir after adding our text */
  170.  ADDRESS COMMAND "Copy " dirname || word(out.i,1) "  " newdir " dates"
  171.  ADDRESS COMMAND "Delete " dirname || word(out.i,1) " quiet"
  172.  
  173. return
  174.  
  175. do_lz:
  176. arg i
  177.  
  178.  /* add my text to the lha files */            /* chage this to your readme file*/
  179.  ADDRESS COMMAND "LZ a "dirname || word(out.i,1)" s:scoopex.txt.displayme"   /* add my bbs ad */
  180.  
  181.  /* move the file to our hold dir after adding our text */
  182.  ADDRESS COMMAND "Copy " dirname || word(out.i,1) "  " newdir " dates"
  183.  ADDRESS COMMAND "Delete " dirname || word(out.i,1) " quiet"
  184.  
  185. return
  186.  
  187. do_warp:                                  /* do warp files */
  188. arg i
  189.  
  190.  /* remove text file file to ram: */
  191.   ADDRESS COMMAND "WTR "dirname || word(out.i,1)
  192.  
  193.   /* add my text to the file */
  194.   ADDRESS COMMAND 'warpck 'dirname || word(out.i,1)
  195.  
  196.  x = "Copy " dirname || word(out.i,1) "  " newdir " dates"         /* move the file */
  197.  ADDRESS COMMAND x
  198.  x = "Delete " dirname || word(out.i,1) " quiet" /* move the file */
  199.  ADDRESS COMMAND x
  200.  
  201. return
  202.  
  203.  
  204. /* This Replaces the Execio Command used in the Wshell version *
  205.  * get the temp file in ram and set up array...                *
  206.  * return # of files in array.0                                */
  207.  
  208. get_tempfile:
  209. arg flag
  210. out. = 0
  211. i = 1
  212.  
  213. if ~ Open(fp,"ram:shit",'R') then do
  214.     return FALSE
  215.     end
  216.  
  217. do while ~ EOF(fp)
  218.    out.i = readln(fp);
  219.    i = i +1
  220.   end
  221. call close(fp)
  222. out.0 = i-2
  223. if out.0 < 1 then return FALSE
  224. return TRUE
  225.  
  226.